package com.ruoyi.movie.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.movie.mapper.MovieRateMapper;
import com.ruoyi.movie.domain.MovieRate;
import com.ruoyi.movie.service.IMovieRateService;

/**
 * 影视评分Service业务层处理
 *
 * @author ruoyi
 * @date 2025-10-28
 */
@Service
public class MovieRateServiceImpl implements IMovieRateService
{
    @Autowired
    private MovieRateMapper movieRateMapper;

    /**
     * 查询影视评分
     *
     * @param movieRateId 影视评分主键
     * @return 影视评分
     */
    @Override
    public MovieRate selectMovieRateById(Integer movieRateId)
    {
        return movieRateMapper.selectMovieRateById(movieRateId);
    }

    /**
     * 根据影视ID查询评分
     *
     * @param movieBasicsId 影视基础ID
     * @return 影视评分
     */
    @Override
    public MovieRate selectMovieRateByMovieBasicsId(Integer movieBasicsId)
    {
        return movieRateMapper.selectMovieRateByMovieBasicsId(movieBasicsId);
    }

    /**
     * 查询影视评分列表
     *
     * @param movieRate 影视评分
     * @return 影视评分
     */
    @Override
    public List<MovieRate> selectMovieRateList(MovieRate movieRate)
    {
        return movieRateMapper.selectMovieRateList(movieRate);
    }

    /**
     * 新增影视评分
     *
     * @param movieRate 影视评分
     * @return 结果
     */
    @Override
    public int insertMovieRate(MovieRate movieRate)
    {
        movieRate.setCreateTime(DateUtils.getNowDate());
        return movieRateMapper.insertMovieRate(movieRate);
    }

    /**
     * 修改影视评分
     *
     * @param movieRate 影视评分
     * @return 结果
     */
    @Override
    public int updateMovieRate(MovieRate movieRate)
    {
        movieRate.setUpdateTime(DateUtils.getNowDate());
        return movieRateMapper.updateMovieRate(movieRate);
    }

    /**
     * 批量删除影视评分
     *
     * @param movieRateIds 需要删除的影视评分主键
     * @return 结果
     */
    @Override
    public int deleteMovieRateByIds(Integer[] movieRateIds)
    {
        return movieRateMapper.deleteMovieRateByIds(movieRateIds);
    }

    /**
     * 删除影视评分信息
     *
     * @param movieRateId 影视评分主键
     * @return 结果
     */
    @Override
    public int deleteMovieRateById(Integer movieRateId)
    {
        return movieRateMapper.deleteMovieRateById(movieRateId);
    }

    /**
     * 根据影视ID删除评分
     *
     * @param movieBasicsId 影视基础ID
     * @return 结果
     */
    @Override
    public int deleteMovieRateByMovieBasicsId(Integer movieBasicsId)
    {
        return movieRateMapper.deleteMovieRateByMovieBasicsId(movieBasicsId);
    }
}
